package com.yqd.d2_inheritance;

public class Teacher extends People {
    private String teacherCode;
    private Integer age = 30;

    public Teacher() {
        super();
        System.out.println("子类无参构造");
    }

    public String getTeacherCode() {
        return teacherCode;
    }

    public void setTeacherCode(String teacherCode) {
        this.teacherCode = teacherCode;
    }

    public void teach() {
        System.out.println("上课");
    }

    public void showAge() {
        System.out.println("Teacher中的age：" + this.age);
        System.out.println("People中的age：" + super.age);
    }

    public void teacherSleep() {
        System.out.println("Teacher中的睡觉：");
        super.sleep();
    }

    @Override
    public void sleep() {
        super.sleep();
        System.out.println("睡半个小时叫醒我");
    }

    public void sleep(int a) {
        super.sleep();
        System.out.println(String.format("睡%d个小时叫醒我", a));
    }
}
